﻿using System;       
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Modeling_TeacherPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        UniversityDatabaseManagerment udm = new UniversityDatabaseManagerment();

        if (Session["WelcomeUser"] != null)
        {
            if (Session["StudentID"] != null)
            {
                if (udm.createConnection() != null)
                {
                    string id = Session["StudentID"].ToString();

                    grvContent.DataSource = udm.showTimeTableByIDstudent(udm.createConnection(), id);
                    grvContent.DataBind();

                    if (grvContent.Rows.Count == 0)
                    {
                        lblNone.Text = "(None)";
                    }

                    GridView1.DataSource = udm.showTimeTableByIDstudentNext(udm.createConnection(), id);
                    GridView1.DataBind();

                    if (GridView1.Rows.Count == 0)
                    {
                        lblNone2.Text = "(None)";
                    }
                }
                else
                {
                    Response.Redirect("~/ErrorPage.aspx");
                }
            }
            else
            {
                Response.Redirect("~/LoginMessage.aspx?id=1");
            }
        }
        else
        {
            Response.Redirect("~/Login.aspx?id=1");
        }
    }
}